home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / IM_Install3.adf / piarc.LZH / imiv24r.rexx < prev    next >
OS/2 REXX Batch file  |  1992-08-20  |  5KB  |  159 lines

  1. /*
  2.  * IMIV24r.rexx  a P.I. module to display the Image from Imagemaster
  3.  *               or Image Professional on GVP's IV-24 in 24-bit color
  4.  *               
  5.  *
  6.  *  Written by: Barry Chalmers
  7.  *         For: Black Belt Systems image processing series IM, IM F/c, and IP.
  8.  * Last Update: May 13th, 1992
  9.  * ---------------------------------------------------------------------------
  10.  * Revision: 1.00  Jan 17, 1992  -  Initial implementation
  11.  *           1.01  May  8, 1992  -  Pal resolutions;
  12.  *                                  slightly faster;
  13.  *                                  Requires IM version 9.11 or later.
  14.  *           1.02  May 13, 1992  -  Bug fixed vertical PAL size got turned on
  15.  *                                  in non-PAL setup;
  16.  *                                  Clearer description of 'mode' default.
  17.  */
  18.  
  19. /*
  20.  * Default display mode   - This is not usually changed by the user
  21.  *                          but the program is capable of it
  22.  */
  23.  themode = 0;  /* 0 = Leave unchanged              */
  24.                /* 1 = Hi-scan (non-interlaced)     */
  25.                /* 2 = Video scan rate (interlaced) */
  26.  
  27.  
  28. /* 
  29.  * Always include this block of code which loads the libraries:
  30.  */
  31. if ~show('L',"rexxsupport.library") then do
  32.   if addlib('rexxsupport.library',0,-30,0) then do
  33.       /* everything's ok */
  34.     end;
  35.   else do
  36.     say 'We Have A Library Problem, Unable To Load "rexxsupport.library"';
  37.     say 'Cannot operate this module without the library - sorry!';
  38.     exit 10;
  39.     end;
  40.   end;
  41.  
  42. /*
  43.  * Always include this block of code which automatically assigns the ARexx
  44.  * port to the image processor that is running (there are several choices!)
  45.  */
  46. prtnme = 'IP_Port'; /* assume Image Professional */
  47. if show('P','IP_Port') = 0 then do
  48.   if show('P','IM_Port') = 0 then do
  49.     say "Can't find image processor's ARexx port!!!"; /* not running? */
  50.     say "This script requires IP, IM or IM F/c to run!";
  51.     exit(20);
  52.     end;
  53.   else do
  54.     prtnme = 'IM_Port'; /* Imagemaster or Imagemaster F/c */
  55.     end;
  56.   end;
  57.  
  58.   /*
  59.    * This code attempts to read a file called "picmdpath" from REXX:
  60.    * If it can't find it, the script will assume that the commands
  61.    * associated with this PI Module are in "c:". If the file exists,
  62.    * the script will look in the path that is specified in the file.
  63.    * If you create this file, you MUST put a complete, correct path
  64.    * in it; if the commands are in a sub-directory, you have to put
  65.    * the trailing slash on the path (like, device:dir/).
  66.    * 
  67.    */
  68.   cmdpath = 'c:';
  69.   if open(fhandle,'rexx:picmdpath','read') then  /* open the file */
  70.     do
  71.       cmdpath = readln(fhandle);
  72.       call close(fhandle);  /* close the file    */
  73.     end
  74.  
  75. /*
  76.  * The function-specific portion of the script begins here:
  77.  * --------------------------------------------------------
  78.  */
  79.  
  80. address(prtnme);      /* communicate with image processor we found           */
  81.  
  82. options results;
  83. 'pal';
  84. pal = result;
  85. options;
  86.  
  87. if pal > 0 then
  88.   do
  89.     h1 = 256;
  90.     h2 = 280;
  91.     h3 = 512;
  92.     h4 = 566;
  93.   end
  94. else
  95.   do
  96.     h1 = 200;
  97.     h2 = 240;
  98.     h3 = 400;
  99.     h4 = 482;
  100.   end
  101.  
  102. options results;
  103. 'gadgets "Lo-Res","320 to 384","Hi-Res","640 to 768"';
  104. theres = result;
  105. options;
  106. if theres = 0 then do
  107.   address;
  108.   exit 0;
  109.   end
  110. theres = theres - 1;
  111.  
  112. options results;
  113. if theres = 0 then do
  114.   'gadgets "Show non- Lace","320 x' h1 '","Show in Lace","320 x' h3 '"';
  115.   end
  116. else do
  117.   'gadgets "Show non- Lace","640 x' h1 '","Show in Lace","640 x' h3 '"';
  118.   end
  119. thelace = result;
  120. options;
  121. if thelace = 0 then do
  122.   address;
  123.   exit 0;
  124.   end
  125. thelace = thelace - 1;
  126.  
  127. options results;
  128. if theres = 0 & thelace = 0 then do
  129.   'gadgets "Show non- Overscan","320 x' h1 '","Show in Overscan","384 x' h2 '"';
  130.   end
  131. if theres = 0 & thelace = 1 then do
  132.   'gadgets "Show non- Overscan","320 x' h3 '","Show in Overscan","384 x' h4 '"';
  133.   end
  134. if theres = 1 & thelace = 0 then do
  135.   'gadgets "Show non- Overscan","640 x' h1 '","Show in Overscan","768 x' h2 '"';
  136.   end
  137. if theres = 1 & thelace = 1 then do
  138.   'gadgets "Show non- Overscan","640 x' h3 '","Show in Overscan","768 x' h4 '"';
  139.   end
  140. thescan = result;
  141. options;
  142.  
  143. if thescan = 0 then do
  144.   address;
  145.   exit 0;
  146.   end
  147. thescan = thescan - 1;
  148.  
  149. options results;
  150. 'current';
  151. parse var result bname ',' bnum ',' brest
  152. 'jackin';             /* attach to image processor's internal data structure */
  153. jackptr = result;     /* fetch the return value from the std ARexx return    */
  154. options;              /* disallow return values from further commands        */
  155. 'lockimage '||bnum;
  156. address command run cmdpath||'imiv24 '||jackptr||' '||theres||' '||thelace||' '||thescan||' '||themode||' '||pal;
  157. 'unlockimage '||bnum;
  158. exit 0;               /* Done. That's all there is to most PI Modules!       */
  159.